package net;

import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;
import java.util.Map;

/**
 * @author krystal
 * @date 2022/11/27 22:13
 */
public class UdpTranslateServer extends UdpEchoServer{
    private Map<String,String> dict=new HashMap<>();

    public UdpTranslateServer(int port) throws SocketException {
        super(port);

        dict.put("baekhyun","啵啵虎");
        dict.put("do","嘟嘟");
        dict.put("krystal","抽抽");
    }

    @Override
    public String process(String request) {
        return dict.getOrDefault(request,"词在词典中未找到");
    }

    public static void main(String[] args) throws IOException {
        UdpTranslateServer server=new UdpTranslateServer(9090);
        server.start();
    }
}
